package com.zdxlz.fcmp.common.mybatis.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description：对外部平台提供的凭证信息表【凭证信息状态】枚举类
 * @Author： aman
 * @Date： 2025/2/8 11:15
 */
@Getter
@AllArgsConstructor
public enum PlatformStatusEnum {
    // 【EPC_OPEN】为默认值
    EPC_OPEN(1, "open"),
    EPC_CLOSE(2, "close"),
    ;
    @EnumValue
    private final Integer code;
    private final String name;

    public static PlatformStatusEnum getByCode(Integer code) {
        for (PlatformStatusEnum platformStatusEnum : PlatformStatusEnum.values()) {
            if (platformStatusEnum.getCode() == code) {
                return platformStatusEnum;
            }
        }
        return null;
    }

    @JsonValue
    public int getCode() {
        return code;
    }
}
